{extend name="template/base" /}

{block name="content"}
<style>
    #item_list_box{
        width: 100%;
        background-color: #fff;
        padding: 15px;
        box-sizing: border-box;
        font-size: 15px;
    }
    #item_list_box p{
        margin: 0;
        padding: 0;
    }
    #item_list_box .item_box{
        width: 100%;
        border: 1px solid #ccc;
        margin-bottom: 20px;
    }
    #item_list_box .item_status{
        padding:  8px;
        line-height: 1.5;
        box-sizing: border-box;
        border-bottom: 1px solid #ccc;
    }
    #item_list_box .item_status p{
        margin: 0;
        padding: 0;
        display: inline-block;
    }
    #item_list_box .wait_review{
        float: right;
        margin-right: 10px !important;
    }
    #item_list_box .item_content_box{
        display: table;
        border-bottom: 1px solid #ccc;
        width: 100%;
    }
    #item_list_box .content_module{
        display: inline-block;
        padding: 8px;
        box-sizing: border-box;
        font-size: 0;
        vertical-align: top;
    }
    #item_list_box .left_module{
        font-size: 15px;
        width: 67%;
        border-right: 1px solid #ccc;
    }
    #item_list_box .right_module{
        width: 32%;
        font-size: 14px;
        line-height: 1.6;
    }
    #item_list_box .img_item{
        width: 120px;
        height: 120px;
        padding: 10px;
    }
    #item_list_box .comment_about{
        width: 100%;
        box-sizing: border-box;
        padding: 10px 8px;
    }
    #item_list_box .comment_about>div{
        display: inline-block;
    }
    #item_list_box .comment_about .btn_group{
        float: right;
    }
    #item_list_box .comment_about .btn_item{
        display: inline-block;
        border: 1px solid #FE7819;
        font-size: 14px;
        padding: 2px 20px;
        border-radius: 5px;
        background-color: #FFFDD9;
        box-sizing: border-box;
        margin: 0 5px;
        cursor: pointer;
        user-select: none;
    }
    #item_list_box .comment_about .btn_item:hover{
        background-color: #FFD1AB;
    }
</style>

<div class="page-container">
    <form class="mb-10 mt-30 ml-15" method="get" action="{:\\think\\Url::build($Request.action)}">
        <input type="hidden" name="is_review" value="{$is_review}">
        <input type="text" class="input-text mb-5" style="width:250px" placeholder="产品名称" name="sales_name" value="{$Request.param.sales_name}">
        <div class="select-box mb-5" style="width:250px; height: 31px">
            <select name="platform" class="select">
                <option value="">选择平台</option>
                {foreach $platform as $pvo}
                <option value="{$pvo.platform_name}">{$pvo.name}</option>
                {/foreach}
            </select>
        </div>
        <input type="text" class="input-text mb-5" style="width:250px" placeholder="昵称" name="booking_people_name" value="{$Request.param.booking_people_name}">
        <input type="text" class="input-text mb-5" style="width:250px" placeholder="手机号" name="booking_people_phone" value="{$Request.param.booking_people_phone}">
        <input type="text" class="input-text mb-5" style="width:250px" placeholder="订单号" name="order_id" value="{$Request.param.order_id}">
        <button type="submit" class="btn btn-success mb-5" id="realname_btn" name=""><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
    </form>
    <div id="item_list_box">
        {volist name="list" id="vo" key="k"}
        <div class="item_box">
            <div class="item_status">
                {if ($vo.is_review == 0)  }
                <p>未评价</p>
                <p class="wait_review">等待审核</p>
                {elseif($vo.is_review == 1) /}
                <p>好评</p>
                {if ($vo.order_status=='finish')}
                <p class="wait_review">完成出行</p>
                {else /}
                <p class="wait_review">完成评价</p>
                {/if}

                {else /}
                <p>差评</p>
                {if ($vo.order_status=='finish')}
                <p class="wait_review">完成出行</p>
                {else /}
                <p class="wait_review">完成评价</p>
                {/if}
                {/if}
            </div>
            <div class="item_content_box">
                <div class="content_module left_module">
                    <p>{$vo.evaluate.comment}</p>
                    <div class="img_list_box">
                        {volist name="$vo.evaluate.src" id="src"}
                        {if ($src!=null)}
                        <img class="img_item" src="{$src}" alt="">
                        {/if}
                        {/volist}
                    </div>
                </div>
                <div class="content_module right_module">
                    <p>路线名称：{$vo.route}</p>
                    <p>出行日期：
                        {if !empty($vo['start_time'])}
                        {$vo.start_time|date='Y-m-d',###}
                        {else /}待定
                        {/if}
                    </p>
                    <p>产品名称：{$vo.sales_name}</p>
                    <p>来源平台：{$vo.platform}</p>
                    <p>昵称：{$vo.booking_people_name}</p>
                    <p>手机号：{$vo.booking_people_phone}</p>
                    <p>订单号：{$vo.order_id}</p>
                </div>
            </div>
            <div class="comment_about">
                <div class="comment_time">
                    点评时间：
                    {if ($vo.evaluate.create_time!=null||$vo.evaluate.create_time!='')}
                    {:date('Y年m月d日 H:i:s',$vo.evaluate.create_time)}
                    {/if}
                </div>
                <div class="btn_group">
                    {if $vo.is_review==0}
                    <!--/order_id/{$vo.order_id}/is_review/1-->
                    <p class="good_comment btn_item" onclick="layer_open('好评','/admin/order/add_evaluate/order_id/{$vo.order_id}/is_review/1')">好评</p>
                    <p class="bad_comment btn_item" onclick="layer_open('差评','/admin/order/add_evaluate/order_id/{$vo.order_id}/is_review/2')">差评</p>
                    {else /}
                    <p class="good_comment btn_item" onclick="good_evaluate('{$vo.order_id}')">好评</p>
                    <p class="bad_comment btn_item" onclick="bab_evaluate('{$vo.order_id}')">差评</p>
                    {/if}
                </div>
            </div>
        </div>
        {/volist}
    </div>
    <div class="page-bootstrap">{$page ?? ''}</div>
</div>
{/block}
{block name="script"}
<script type="text/javascript" src="__LIB__/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="__LIB__/template/template.js"></script>
<script>
    $(function() {
        var left_module = [].slice.apply($('.left_module'));
        var right_module = [].slice.apply($('.right_module'));
        for (var i = 0; i < left_module.length; i++) {
            var max_height = Math.max($(left_module[i]).outerHeight(), $(right_module[i]).outerHeight());
            $(left_module[i]).outerHeight(max_height);
            $(right_module[i]).outerHeight(max_height);
        }
    })

    function good_evaluate(order_id){
        $.ajax({
            type: 'POST',
            url: "/admin/order/good_evaluate?order_id="+order_id,
            data: null,
            success: function (re) {
                if (re.msg) {
                    layer.msg(re.msg, {
                        time: 1000, //1s后自动关闭
                    }, function () {
                        //关闭后刷新
                        location.reload();
                    });
                }
            }
        });
    }

    function bab_evaluate(order_id){
        $.ajax({
            type: 'POST',
            url: "/admin/order/bab_evaluate?order_id="+order_id,
            data: null,
            success: function (re) {
                if (re.msg) {
                    layer.msg(re.msg, {
                        time: 1000, //1s后自动关闭
                    }, function () {
                        //关闭后刷新
                        location.reload();
                    });
                }
            }
        });
    }
</script>
{/block}
